package com.itheima.controller;

import com.itheima.entity.Result;
import com.itheima.service.ReportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;

/**
 * @Description 统计控制类
 * @Author makun
 * @Date 2023/9/20 16:36
 * @Version 1.0
 */
@RestController
@RequestMapping("/report")
public class ReportController {
    @Autowired
    private ReportService reportService;

    /**
     * 获取系统运营数据
     * @return
     */
    @GetMapping("/business")
    public Result getBusiness() {
        return Result.buildSuccess(reportService.getBusinessReportData());
    }

    /**
     * 获取套餐占比分析
     * @return
     */
    @GetMapping("/setMeal")
    public Result getSetMeal() {
        return Result.buildSuccess(reportService.getSetMealReport());
    }

    /**
     * 获取会员统计图表的信息
     * @return
     */
    @GetMapping("/member")
    public Result getMember() {
        Map<String, List<Integer>> memberReport = reportService.getMemberReport();
        return Result.buildSuccess(memberReport);
    }
}
